<?php
header("content-type:text/html;charset=utf-8");
	
	require './configs/config.php';

	//获取用户的传参

	//导入所有的控制器
//require './controllers/UserController.class.php';
//require './controllers/GoodsController.class.php';
    function __autoload($classname){
        if(file_exists("./models/{$classname}.class.php")){
            require "./models/Model.class.php";
        }elseif (file_exists("./controllers/{$classname}.class.php")){
            require "./controllers/{$classname}.class.php";
        }else{
            header('HTTP/1.1 404 not found');
            echo "<h1>NOT FOUND 404</h1>";
            exit;
        }
  }


	//获取控制器名
	$c = (!empty($_GET['c']))?$_GET['c']:'Index';
	//获取操作名
	$a = (!empty($_GET['a']))?$_GET['a']:'index';

	//拼装类名
	$classname = $c.'Controller';

	//实例化控制器
	
	$controller = new $classname();

	//调取方法
	$controller->$a();
?>